using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class UIManager : MonoBehaviour
{
    [SerializeField] private GameObject controlsScreen;
    [SerializeField] private TextMeshProUGUI winText;

    private void Awake()
    {
        if(controlsScreen != null) HideControls();

        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;

        if(SceneManager.GetActiveScene().buildIndex == 5)
        {
            int winner = GameManager.score[0] > GameManager.score[1] ? 0 : 1;
            winText.text = GameManager.score[0] > GameManager.score[1] ? "Blue Team Wins!" : "Red Team Wins!";
        }
    }

    public void StartGame()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }

    public void GoToScene(int index)
    {
        SceneManager.LoadScene(index);
    }

    public void ShowControls()
    {
        controlsScreen.SetActive(true);
    }

    public void HideControls()
    {
        controlsScreen.SetActive(false);
    }

    public void QuitGame()
    {
        Application.Quit();
    }
}
